#!/bin/bash
#
# build script for travis
#

godirectories="app baseobject cmd/ps-stats cmd/ps-top connector context display event file_io_latency global key_value_cache lib logger memory_usage mutex_latency p_s/ps_table rc screen setup_instruments stages_latency statement_summary table table_io_latency table_lock_latency user_latency version view wait_info"

set -e

# check which directory we are called from/in
dirname=$(dirname $0)

. $dirname/bootstrap

#echo "Verifying code is formatted via 'gofmt -s -w ...'"
#for d in $godirectories; do
#	echo "- $d"
#	gofmt -s -w $d/
#	git diff --exit-code --quiet
#done

echo "Building"
script/build

echo "Running tests..."
cd .gopath/src/github.com/sjmudd/ps-top
go test ./...

echo "Done"
